﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

using YouHP.Utility;
using YouHP.BLL;
using YouHP.Model;
using YouHP.Model.Group;
using System.Web;

namespace YouHP.Pages.User
{
    public class Log : YouHP.Pages.User.UserBasePage
    {
        protected LogTopicInfo logTopicData;
        protected List<LogCommentInfo> LogCommentList;
        protected string[] tagArrSplit = null; 
        protected int DataCount;
        
        protected override void ShowPage()
        {
            base.ShowPage();
            if (ErrorCount > 0) return;

            HandleCommon();
            if (ErrorCount > 0) return;

            HandleGet();
        }

        protected void HandleCommon()
        {
            this.SetTitle("日志");
            this.AddLocation("日志", "");
            this.AddScriptSrc("/support/Alpha/Js/mootools.js");


        }

        protected void HandleGet()
        {
            int lid = RequestTools.GetQueryInt("lid", 0);
            if (lid <= 0)
            {
                this.AddErrLine("无效的 lid ");
                return;
            }
            logTopicData = LogTopicBLL.Instance.GetLogTopicInfo(lid);
            if (logTopicData.Id <= 0)
            {
                this.AddErrLine("该日志不存在或已经被删除");
                return;
            }

            if (logTopicData.Tags != "")
            {
                tagArrSplit = Regex.Split(logTopicData.Tags, "\\s+");
            }
           //将日志评论设置为已读
            LogCommentBLL.Instance.UpdateLogCommentState(logTopicData.Id, 1);

            //LogCommentList = LogCommentBLL.Instance.GetLogCommentList(10, 1, lid, out DataCount);
        }
    }
}
